package com;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.omg.SendingContext.RunTime;

import com.utils.LogUtils;
import com.utils.PropertyUtils;

public class WriteTime implements Runnable{
	@Override
	public void run() {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			while(true){
				String line = br.readLine();
				if(line.equals("record")){
					System.out.println(LogUtils.getFilePath());
					LogUtils.println(Starter.startTime+"-"+Starter.current+" "+(Starter.startTime-Starter.current)+" minutes passed" );
					System.out.println(Starter.startTime+"-"+Starter.current+" "+(Starter.startTime-Starter.current)+" minutes passed");
					Starter.startTime = Starter.current;
				}else if(line.equals("openLog")){
					Runtime rt = Runtime.getRuntime();
					String filePath = LogUtils.getFilePath();
					System.out.println(filePath);
					rt.exec("notepad "+filePath.substring(1,filePath.length()));
				}else if(line.equals("logPath")){
					System.out.println(LogUtils.getFilePath());
				}
			}
//		BufferedWriter bw = new BufferedWriter(new );
		} catch (Exception e) {
			System.out.println("an error occured in WriteTime");
//			e.printStackTrace();
		}
	}

}
